From: Andrew Cooper Date: Mon, 20 Jan 2014 08:49:20 +0000 (+0100) Subject: common/memory: Fix ABI breakage for XENMEM_add_to_physmap X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~5658 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=ebc168f238ab7a729c45032c9663b14844f34656;p=xen.git common/memory: Fix ABI breakage for XENMEM_add_to_physmap caused by c/s 4be86bb194e25e46b6cbee900601bfee76e8090a In public/memory.h, struct xen_add_to_physmap has 'space' as an unsigned int, but struct xen_add_to_physmap_batch has 'space' as a uint16_t. By defining xenmem_add_to_physmap_one() with space defined as uint16_t, the now-common xenmem_add_to_physmap() implicitly truncates xatp->space from unsigned int to uint16_t, which changes the space switch()'d upon. This wouldn't be noticed with any upstream code (of which I am aware), but was discovered because of the XenServer support for legacy Windows PV drivers, which make XENMEM_add_to_physmap hypercalls using spaces with the top bit set. The current Windows PV drivers don't do this any more, but we 'fix' Xen to support running VMs with out-of-date tools. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich Release-Ack: Ian Campbell Acked-by: Keir Fraser --- diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 293b6e246f..127cce0f50 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -970,7 +970,7 @@ void share_xen_page_with_privileged_guests( int xenmem_add_to_physmap_one( struct domain *d, - uint16_t space, + unsigned int space, domid_t foreign_domid, unsigned long idx, xen_pfn_t gpfn) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 32c0473a95..172c68c282 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -4522,7 +4522,7 @@ static int handle_iomem_range(unsigned long s, unsigned long e, void *p) int xenmem_add_to_physmap_one( struct domain *d, - uint16_t space, + unsigned int space, domid_t foreign_domid, unsigned long idx, xen_pfn_t gpfn) diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index f90ed745e5..b183189f80 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -356,7 +356,7 @@ static inline unsigned int get_order_from_pages(unsigned long nr_pages) void scrub_one_page(struct page_info *); -int xenmem_add_to_physmap_one(struct domain *d, uint16_t space, +int xenmem_add_to_physmap_one(struct domain *d, unsigned int space, domid_t foreign_domid, unsigned long idx, xen_pfn_t gpfn);